import { Component, PropTypes } from '@didi/teddy-immutable'
const { string, func, bool } = PropTypes

const noop = () => {}
class QueryButton extends Component {
  static propTypes = {
    loading: bool,
    loadingText: string,
    text: string,
    onTap: func
  }

  static defaultProps = {
    text: '查询',
    loading: false,
    loadingText: '查询中',
    onTap: noop
  }

  onTap(e) {
    if (this.props.loading) {
      return
    }
    this.props.onTap(e)
  }
}

export default QueryButton